package com.github.xaidanwang.data.upload.download.scheduler;

import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author wang yi fei
 * @date 2019/10/17 14:35
 */

@Configuration
public class SchedulerRunner implements ApplicationRunner {
	public static ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(4,new BasicThreadFactory.Builder().namingPattern("scheduled-pool-%d").daemon(true).build());
	@Autowired
	private CaptureLogSaveScheduler captureLogSaveScheduler;
	@Override
	public void run(ApplicationArguments args) throws Exception {
//		scheduledExecutorService.scheduleAtFixedRate(captureLogSaveScheduler,2,2, TimeUnit.SECONDS);
	}
}
